﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Web.Mvc;

namespace CSF.Utility.Mvc
{
    public static class ControllerExtensions
    {
        public static ActionResult GoBack(this Controller controller, int level = 1)
        {
            var result = new ContentResult();
            result.ContentType = "text/html";
            result.Content = "<html><script type=\"text/javascript\" languange=\"javascript\">window.history.go(-" + level.ToString() + ");</script></html>";
            result.ContentEncoding = controller.Request.ContentEncoding;
            return result;
        }
    }
}
